Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: replace bn.js with bigint wrapper #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ChALkeR
Copy link
Contributor

@ChALkeR ChALkeR commented Nov 5, 2024

bn.js v2 is very old
replace it with a light implementation

Can be migrated to top-level native BigInt later

Let's release the version with bn.js first, and then investigate this

class BN {
#value

constructor(number, base, endian) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have this wrapper somewhere else? Maybe in currency? To unify I mean

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no
a fully compatible bn.js replacement is not this clean
here, bn.js usage is very limited so it can be replaced

also, this was still using bn.js@2

this.#value = BigInt(number)
} else if (typeof number === 'string') {
if (base === 'hex') base = 16
if (base === undefined) base = /[a-f]/.test(number) ? 16 : 10
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not actually what bn does, recheck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants